/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ordering.pojo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author sulan
 */
@Entity
@Table(name = "t_order_detail")
@NamedQueries({@NamedQuery(name = "TOrderDetail.findAll", query = "SELECT t FROM TOrderDetail t"), @NamedQuery(name = "TOrderDetail.findById", query = "SELECT t FROM TOrderDetail t WHERE t.id = :id"), @NamedQuery(name = "TOrderDetail.findByMenuId", query = "SELECT t FROM TOrderDetail t WHERE t.menuId = :menuId"), @NamedQuery(name = "TOrderDetail.findByQty", query = "SELECT t FROM TOrderDetail t WHERE t.qty = :qty")})
public class TOrderDetail implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Basic(optional = false)
    @Column(name = "menu_id")
    private long menuId;
    @Column(name = "qty")
    private Float qty;
    @JoinColumn(name = "order_head_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private TOrderHead orderHeadId;

    public TOrderDetail() {
    }

    public TOrderDetail(Long id) {
        this.id = id;
    }

    public TOrderDetail(Long id, long menuId) {
        this.id = id;
        this.menuId = menuId;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public long getMenuId() {
        return menuId;
    }

    public void setMenuId(long menuId) {
        this.menuId = menuId;
    }

    public Float getQty() {
        return qty;
    }

    public void setQty(Float qty) {
        this.qty = qty;
    }

    public TOrderHead getOrderHeadId() {
        return orderHeadId;
    }

    public void setOrderHeadId(TOrderHead orderHeadId) {
        this.orderHeadId = orderHeadId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TOrderDetail)) {
            return false;
        }
        TOrderDetail other = (TOrderDetail) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ordering.pojo.TOrderDetail[id=" + id + "]";
    }

}
